package com.zan.backend.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Author Zan
 * @Create 2024/3/15 16:35
 * @Description :
 */
@AllArgsConstructor
@Getter
public enum CommonBaseErrorEnum implements BaseErrorEnum {

    BUSINESS_ERROR(0, "{0}"), // 这里使用MessageFormat.format来进行赋值，就必须指定，不然会报错can't parse argument number:

    SYSTEM_ERROR(-1, "系统出小差了，请稍后再试哦~~"), // 业务异常一般 > 1

    PARAM_INVALID(-2, "参数校验失败，请重新输入参数"),

    LOCK_LIMIT(-3, "请求太频繁了，请稍后再试"),

    ILLEGAL_PARAMETER(-4, "非法参数，请稍后再试"),

    TOKEN_EXPIRED(-5, "Token已经失效，请重新登录"),

    FILE_FAIL(-6, "文件上传失败");

    private final Integer code;

    private final String msg;

    @Override
    public Integer getErrorCode() {
        return code;
    }

    @Override
    public String getErrorMsg() {
        return msg;
    }
}
